package com.wordsbank.controller;

import com.wordsbank.dao.WordMapper;
import com.wordsbank.entity.dto.WordDto;
import com.wordsbank.entity.po.Word;
import com.wordsbank.service.WordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @AUTHOR : Dragon_Yang
 * @File : WordsBankApi
 * @DESCRIPTION :
 * @DATE : 2022/3/4 15:27
 */
@RestController
public class WordsBankApi {
    @Autowired
    WordService wordService;

    @PostMapping("/insert")
    public boolean addWord(@RequestBody WordDto wordDto){
        return wordService.addWord(wordDto);
    }

    @PostMapping("/list")
    public List<Word> getWordList(@RequestParam String library){
        return wordService.getWordList(library);
    }

    @PostMapping("/update")
    public boolean updateWord(@RequestBody Word word){
        return wordService.updateWord(word);
    }

    @PostMapping("/delete")
    public boolean deleteWord(@RequestBody Word word){
        return wordService.deleteWord(word);
    }

}
